package com.bdth.bdthiss.vo;

import java.util.List;

public class Pagination<T> {

    private Integer page;

    private Integer rows;

    private String sort;

    private String order;

    private Integer total;

    private List<T> items;

    public Pagination(Integer page, Integer rows, String sort, String order) {
        this.page = page;
        this.rows = rows;
        this.sort = sort;
        this.order = order;
    }

    public Integer offset() {
        return null == page || null == rows ? null : (this.page - 1) * this.rows;
    }

    public Integer limit() {
        return this.rows;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }

    public Integer getRows() {
        return rows;
    }

    public void setRows(Integer rows) {
        this.rows = rows;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }
}
